/*
 * @Author: [kangjie]
 * @Date: 2022-04-28 09:09:09
 * @LastEditors: [kangjie]
 * @LastEditTime: 2022-04-28 09:16:12
 * @Description: 
 */
const obj ={
  name:"张三",
  age:20
};
Object.defineProperty(obj,'name',{
  enumerable:true, //允许当前属性 被循环
  configurable:true, //允许当前属性 被删除 被配置
  get(){
    //getter
    console.log('我被获取了');
    return 'lisi'
  },
  set(newValue){
    //setter
    console.log('我被设置了',newValue);
  }
});
console.log(obj.name);
obj.name='王五';
console.log(obj.name);
// // 取值操作
// console.log(obj.name);
// // 赋值操作
// obj.name='李四';